package com.itheima.extend;

import java.math.BigDecimal;
import java.math.RoundingMode;

public class BigDecimelDemo {

    public static void main(String[] args) {
        double a = 0.07;
        double b = 0.02;
        System.out.println(a+b);
        System.out.println("=======================");

        BigDecimal A = new BigDecimal("0.07");
        BigDecimal B = new BigDecimal("0.03");
        BigDecimal subtract = A.subtract(B);
        System.out.println(subtract.doubleValue());

        BigDecimal add = A.add(B);
        System.out.println(add.doubleValue());

        BigDecimal multiply = A.multiply(B);
        System.out.println(multiply.doubleValue());

        BigDecimal divide = A.divide(B, 2, RoundingMode.HALF_UP);
        System.out.println(divide.doubleValue());
    }

}
